#ifndef NPC_H
#define NPC_H

#include <map>
#include <string>
#include "flag.h"
#include "types.h"
#include <SDL/SDL.h>

class Npc
{
    private:
        static std::map<int, Npc*> Npcs;
        int id;
        std::string name;

        position pos;
        position flag;
        float velX, velY;
        int dir;
        int movementSpeed;

        SDL_Rect box;
        SDL_Rect myClip[8];
        SDL_Surface *nameText;

        void update_rect();
        void calculate_vel();
        void stop();
        void set_clips();

    public:
        Npc(int id, std::string name, int x, int y);
        ~Npc();

        static Npc* GetNpcFromID(int id);
        static std::map<int, Npc*> GetNpcList();
        static Npc* GetNpcOnPosition(int posX, int posY);
        static void removeNpcs();

        void create_flag(int x, int y);
        void move(Uint32 deltaTicks);

        int x();
        int y();
        int get_id();
        std::string get_name();
        SDL_Rect get_box();

        void set_x(int x);
        void set_y(int y);

        void draw();
};

#endif // NPC_H
